package com.tbit.common.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;

import java.io.Serializable;

import java.time.LocalDateTime;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tbit.common.constant.OperationPlatform;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldNameConstants;
import org.hibernate.validator.constraints.Length;

/**
 * 车辆操作日志
 */
@Data
@TableName("machine_op_log")
@FieldNameConstants
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MachineOpLog implements Serializable {
    /**
     * 日志id
     */
    @NotNull(message = "[日志id]不能为空")
    @TableId(type = IdType.AUTO)
    private Long logId;
    /**
     * 区域id
     */
    @NotNull(message = "[品牌id]不能为空")
    private Integer accountId;
    /**
     * 车辆id
     */
    private Integer machineId;
    /**
     * 车辆编号
     */
    @Size(max = 30, message = "编码长度不能超过30")
    @Length(max = 30, message = "编码长度不能超过30")
    private String userCode;
    /**
     * 设备编号
     */
    @NotBlank(message = "[设备编号]不能为空")
    @Size(max = 50, message = "编码长度不能超过50")
    @Length(max = 50, message = "编码长度不能超过50")
    private String machineNO;
    /**
     * 操作内容
     */
    @NotBlank(message = "[操作内容]不能为空")
    @Size(max = 31, message = "编码长度不能超过31")
    @Length(max = 31, message = "编码长度不能超过31")
    private String operation;
    /**
     * 操作类型
     */
    @Size(max = 31, message = "编码长度不能超过31")
    @Length(max = 31, message = "编码长度不能超过31")
    private String opType;
    /**
     * 操作人
     */
    @Size(max = 31, message = "编码长度不能超过31")
    @Length(max = 31, message = "编码长度不能超过31")
    private String opUser;
    /**
     * 操作人手机号
     */
    @Size(max = 31, message = "编码长度不能超过31")
    @Length(max = 31, message = "编码长度不能超过31")
    private String opUserPhone;
    /**
     * 操作平台 1-用户端 2-管理端 3-运维端
     *
     * @see OperationPlatform
     */
    private Integer opPlatform;
    /**
     * 操作结果
     */
    private Boolean result;
    /**
     * 操作时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "[操作时间]不能为空")
    private LocalDateTime opTime;
    /**
     * 详情
     */
    @Size(max = 255, message = "编码长度不能超过255")
    @Length(max = 255, message = "编码长度不能超过255")
    private String detail;

}
